import Vue from 'vue'
import VueRouter from 'vue-router'
import Film from "@/views/film/film.vue"
import Detail from "@/views/film/detail.vue"
import Cinema from "@/views/cinema/cinema.vue"
import CinemaDetail from "@/views/cinema/cinemadetail.vue"
import CinemaFilm from "@/views/cinema/cinemafilms.vue"
import DateInfo from "@/views/cinema/dateinfo.vue"
import News from "@/views/news/news.vue"
import User from "@/views/user/user.vue"
import Home from "@/views/home/home.vue"
import FilmList from "@/views/film/filmlist.vue"
import City from "@/components/city.vue"
import Chose from "@/views/film/chose.vue"
import Login from "@/views/user/login.vue"
import Select from "@/views/user/select.vue"


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:{"name":"home"},
    meta:{flag:true}
  },
  // {
  //   path:"/film",
  //   name:"film",
  //   component:Film,
  //   meta:{
  //     flag:true
  //   }
  // },
  {
    path:'/home',
    name:'home',
    component:Home,
    meta:{flag:true},
    redirect:{path:'/filmlist'},
    children:[{
        path:'/filmlist',
        'name':'filmlist',
        component:FilmList,
        meta:{flag:true},
        redirect:{path:'/filmlist/nowPlaying'},
        children:[{
            path:':type',
            'name':'film',
            component:Film,
            meta:{flag:true}
        }]
    }]
  },
  {
      path:'/detail/:id',
      component:Detail,
  },
{
      path:'/city',
      name:'city',
      component:City
},


  {
    path:'/cinema/:cityid',
    component:Cinema,
    meta:{
      flag:true
    }
  },
  {
    path:'/cinemadetail/:id',
    component:CinemaDetail,
    redirect:{name:'cinemafilm'},
    children:[{
        path:'film',
        name:'cinemafilm',
        component:CinemaFilm,
        children:[{
            path:'date',
            name:'datainfo',
            component:DateInfo
        }]
      }]
  },
{
  path:'/chose',
  name:'chose',
  component:Chose
},


  {
    path:'/news',
    component:News,
    meta:{
      flag:false
    }
  },
  {
    path:'/user',
    component:User,
    meta:{
      flag:true
    }
  },
  {
    path:'/login',
    component:Login,
    
  },
  {
    path:'/select',
    component:Select,
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
